﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SC2parser.Model;

namespace SC2parser.Function
{
    public class UpdateMatches
    {
        /// <summary>
        /// Updates the source list of matches with results form the results list
        /// </summary>
        /// <param name="source">The list to update</param>
        /// <param name="results">The list with the results</param>
        public void Update(ref List<Match> source, List<Match> results)
        {
            foreach (Match m in source)
            {
                Match resultingMatch = results.First(x=>x.MatchId == m.MatchId);
                m.PlayerOne.Wins = resultingMatch.PlayerOne.Wins;
                m.PlayerTwo.Wins = resultingMatch.PlayerTwo.Wins;
            }
        }

        public UpdateMatches()
        {

        }
    }
}
